package cn.wen233.srpc.basic.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 响应类
 *
 * @author wenei
 * @date 2021-10-27 15:30
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Response implements Serializable {

    private static final long serialVersionUID = 222;

    public static final Response REFUSE = new Response("-1", -1, "Filter Refuse", null);

    /**
     * 请求id
     */
    private String requestId;

    /**
     * 响应code
     */
    private int code;

    /**
     * 响应message
     */
    private String message;

    /**
     * 数据
     */
    private Object data;

    public void status(Status status) {
        this.code = status.getCode();
        this.message = status.getMessage();
    }
}
